Why do I have to make the variable global